package com.gxy.learn.design.model.create.prototype.shallowclone;

import lombok.extern.slf4j.Slf4j;

/**
 * @description: 原形模式测试类-浅拷贝
 * @author: gaoxueyong
 * @Date: 2022/11/7 11:58
 */
@Slf4j
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
////        创建一个圆形类对象
//        Realizatype realizatype = new Realizatype();
//
////        调用原形类中的clone方法进行clone
//        Realizatype clone = realizatype.clone();
//
//        log.info("原形对象和克隆出来的是不是同一个对象:{}",realizatype == clone);
//

        Citation citation = new Citation();
        Student student = new Student();
        student.setName("张三");
        citation.setStudent(student);
        citation.show();
        Citation citation1 = citation.clone();
        citation1.getStudent().setName("李四");
        citation1.show();
        citation.show();
//        浅克隆出的对象的属性都是一样的



    }
}
